Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Using BUFFER-FIELD objects
As you saw in the previous chapter, there is a
BUFFER-FIELDobject for each field in a buffer, whether the buffer is static or dynamic. You can access a field within a buffer through its handle, using one of two types of arguments to theBUFFER-FIELDmethod, either its ordinal position within the buffer or its fieldname.Buffer fields have all the same attributes that static field-level objects have. You’re already familiar with these attributes from static syntax, including
COLUMN-LABEL,DATA-TYPE,DBNAME,DECIMALS,EXTENT,FORMAT,HANDLE,HELP,INITIAL,LABEL,MANDATORY,NAME,TABLE, andWIDTH-CHARS. Buffer field objects also have several useful attributes distinctive to the object and accessible only through its handle. This section summarizes those objects.You cannot create or delete a buffer field independent of its buffer. Buffer field objects are created when a buffer is created. They are deleted along with the buffer, if it is dynamic. In the case of static buffers, the buffer field is really just a handle through which you can access useful attributes.
BUFFER-HANDLE attribute
This attribute is the handle of the buffer the field belongs to. So, the
BUFFER-FIELDhandle points from the buffer to one of its fields, and theBUFFER-HANDLEpoints from any field back to its buffer.BUFFER-NAME attribute
This
CHARACTERattribute holds the name of the buffer the field belongs to.BUFFER-VALUE and STRING-VALUE attributes
The
BUFFER-VALUEis the value of the field in its native data type. The attribute therefore holds a value in whatever the data type of the field is. TheSTRING-VALUE, on the other hand, is aCHARACTERattribute that holds the field value as it is formatted for display. It is therefore in the same format as theSCREEN-VALUEof a displayed field. Note that this is not necessarily the same as what the expressionSTRING(hField:BUFFER-VALUE)would return, because theSTRING-VALUEincludes any characters that are part of the field format, whereas using theSTRINGfunction simply turns the value into a character string without applying any special formatting to it.POSITION attribute
This
INTEGERattribute is the ordinal position of the field within the buffer.Note that there is a difference between the order of the fields you obtain using the
BUFFER-FIELD(n)form to identify the field and the value of the field’sPOSITIONattribute. The order usingBUFFER-FIELD(n)is the display order of the fields, which is determined using the Order # as it is assigned in the Data Dictionary. ThePOSITIONattribute is assigned internally as fields are created for a table, and does not change, even though the display Order # can be changed. In addition, the first field position is reserved so that the numbering of thePOSITIONbegins with 2. For example, this code shows thePOSITIONattribute value for each Customer field:
Figure 19–10 shows the result.
Figure 19–10: Result of using the POSITION attribute
![]()
The following chapter continues the discussion of dynamic data management objects with information on how to create and use dynamic temp-tables and dynamic browses.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |